package cn.uniquesoft.controller;

import cn.uniquesoft.controller.base.BaseController;
import cn.uniquesoft.manager.ClientManager;
import cn.uniquesoft.page.DataGrid;
import cn.uniquesoft.service.IConnectService;
import cn.uniquesoft.vo.ConnectVO;
import cn.uniquesoft.vo.UserVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value="/connect")
public class ConnectController extends BaseController<ConnectVO> {
		private IConnectService connectService;
		public ConnectController(IConnectService connectService){
			super();
			this.baseService=connectService;
			this.connectService = connectService;
			this.indexName="connect/index";
		}

	@RequestMapping(value = "/pageQuery")
	@ResponseBody
	public DataGrid pageQuery(ConnectVO item) {
		DataGrid dg = new DataGrid();
		UserVO userVO = null;
		try {
			userVO = ClientManager.getInstance().getClient().getUser();
		} catch (Exception e) {

		}
		if (userVO != null) {
			if (userVO.getIvisible() == 1) {

			} else if (userVO.getIvisible() == 2) {
				item.setIbank(userVO.getIorgname());
			} else {
				item.setIcreator(userVO.getIid());
			}
		}
		return this.baseService.pageQuery(item);
	}
}
